<html><head><title>Billboard.pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - Billboard
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
<font color="#924B72">#CameraSpeed</font> = 1

<b><font color="#3A3966">IncludeFile</font></b> <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/3d/Screen3DRequester.pb&quot;

<b><font color="#3A3966">Define</font></b>.f KeyX, KeyY, MouseX, MouseY

<b><font color="#3A3966">If</font></b> <font color="#3A3966">InitEngine3D</font>()
  
<font color="#3A3966">  InitSprite</font>()
<font color="#3A3966">  InitKeyboard</font>()
<font color="#3A3966">  InitMouse</font>()
  
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">Screen3DRequester</font>()
    
<font color="#3A3966">    Add3DArchive</font>(<font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/3d/Data/Textures&quot;, <font color="#924B72">#PB_3DArchive_FileSystem</font>)
    
    <font color="#3A3966">; First create our material, with a little rotate effect
</font>    <font color="#3A3966">;
</font>    Material =<font color="#3A3966"> CreateMaterial</font>(<font color="#924B72">#PB_Any</font>,<font color="#3A3966"> LoadTexture</font>(0, &quot;clouds.jpg&quot;))
<font color="#3A3966">    RotateMaterial</font>(Material, 0.05, 1)
    
    <font color="#3A3966">; Then create the billboard group and use the previous material
</font>    <font color="#3A3966">;
</font>    Billboard =<font color="#3A3966"> CreateBillboardGroup</font>(<font color="#924B72">#PB_Any</font>,<font color="#3A3966"> MaterialID</font>(Material), 10, 10)
    
<font color="#3A3966">    AddBillboard</font>(Billboard,   0, 0, -40)
<font color="#3A3966">    AddBillboard</font>(Billboard, -20, 0, -40)
<font color="#3A3966">    AddBillboard</font>(Billboard,  20, 0, -40)
    
    Camera =<font color="#3A3966"> CreateCamera</font>(<font color="#924B72">#PB_Any</font>, 0, 0, 100, 100)
    
    <b><font color="#3A3966">Repeat</font></b>
<font color="#3A3966">      Screen3DEvents</font>()
      
      <b><font color="#3A3966">If</font></b> <font color="#3A3966">ExamineMouse</font>()
        MouseX = -<font color="#3A3966">MouseDeltaX</font>() * <font color="#924B72">#CameraSpeed</font> * 0.05
        MouseY = -<font color="#3A3966">MouseDeltaY</font>() * <font color="#924B72">#CameraSpeed</font> * 0.05
      <b><font color="#3A3966">EndIf</font></b>
      
      <b><font color="#3A3966">If</font></b> <font color="#3A3966">ExamineKeyboard</font>()
        
        <b><font color="#3A3966">If</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Left</font>)
          KeyX = -<font color="#924B72">#CameraSpeed</font> 
        <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Right</font>)
          KeyX = <font color="#924B72">#CameraSpeed</font> 
        <b><font color="#3A3966">Else</font></b>
          KeyX = 0
        <b><font color="#3A3966">EndIf</font></b>
        
        <b><font color="#3A3966">If</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Up</font>)
          KeyY = -<font color="#924B72">#CameraSpeed</font> 
        <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Down</font>)
          KeyY = <font color="#924B72">#CameraSpeed</font> 
        <b><font color="#3A3966">Else</font></b>
          KeyY = 0
        <b><font color="#3A3966">EndIf</font></b>
        
      <b><font color="#3A3966">EndIf</font></b>
      
<font color="#3A3966">      RotateCamera</font>(Camera, MouseY, MouseX, 0, <font color="#924B72">#PB_Relative</font>)
<font color="#3A3966">      MoveCamera  </font>(Camera, KeyX, 0, KeyY)
      
<font color="#3A3966">      RenderWorld</font>()
<font color="#3A3966">      Screen3DStats</font>()
<font color="#3A3966">      FlipBuffers</font>()
    <b><font color="#3A3966">Until</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Escape</font>) <b><font color="#3A3966">Or</font></b> Quit = 1
  <b><font color="#3A3966">EndIf</font></b>
  
<b><font color="#3A3966">Else</font></b>
<font color="#3A3966">  MessageRequester</font>(&quot;Error&quot;, &quot;The 3D Engine can't be initialized&quot;,0)
<b><font color="#3A3966">EndIf</font></b>

<b><font color="#3A3966">End</font></b></font></pre>
</body></html>
